package calendar.view.panels;

import calendar.model.CalendarModel;
import com.google.api.services.calendar.model.CalendarList;
import com.google.api.services.calendar.model.CalendarListEntry;
import swing.StackPanel;

import java.awt.*;
import java.util.List;

public class CalendarListStackPanel extends StackPanel<CalendarList, CalendarListEntry> {
    public CalendarListStackPanel() {
        CalendarModel.CALENDARS.addObserver(this);
    }

    @Override
    protected Component createItemPanel(CalendarListEntry calendarListEntry) {
        return new CalendarListEntryGridPanel(calendarListEntry);
    }

    @Override
    protected List<CalendarListEntry> parse(CalendarList calendarList) {
        return calendarList.getItems();
    }
}
